<?php
include_once(_APP_PATH. "modules/controlls/controllers/params/params_field.php");
class ParamsFieldSelect extends ParamsField{

	public function PreparePostData($fieldPostData)
	{
		$fieldPostData = (string)$fieldPostData;
		
		$realData = null;
		
		$values = (array)$this->GetParam('values');
		foreach ($values as $value => $data)
		{
			if ((is_array($data) && array_key_exists($fieldPostData, $data)) 
				|| ($value == $fieldPostData))
			{
				$realData = $fieldPostData;
				break;	
			}
		}
		
		return $realData;
	}

	public function PrepareOutData($fieldData)
	{
		return (string)$fieldData;
	}	
	
}